www.gusucode.com > 基于VBLAST-OFDM的MATLAB SIMULATION,图形化界面,并且给出了各仿真图 > 基于VBLAST-OFDM的MATLAB SIMULATION,图形化界面,并且给出了各仿真图/vblast-ofdm simulation/tx_convert_to_time.m

    

function time_syms = tx_convert_to_time(mod_ofdm_syms,SimulationParameters) 

global SimulationConstants;

fft_length=SimulationParameters.FFTPoints;

num_data_carriers=SimulationConstants.NumDataSubc;

%if there is a zeropad option
if SimulationParameters.ZeroPad==1
    x=fft_length-num_data_carriers;
    temp1=[];
    temp2=[];
    temp3=[];
    %insert data carriers around center DC, which is zero and with zero
    %padding on either side of the data carrier set
    for i=1:num_data_carriers:length(mod_ofdm_syms)
        temp1=mod_ofdm_syms(:,i:i+(num_data_carriers-1));
        temp2=[zeros(size(temp1,1),(x/2-1)) temp1(:,1:length(temp1)/2) zeros(size(temp1,1),1) temp1(:,length(temp1)/2+1:length(temp1)) zeros(size(temp1,1),x/2)];
        temp3=[temp3 temp2];
        temp1=[];
        temp2=[];
    end
    mod_ofdm_syms=temp3;    
end
num_symbols = size(mod_ofdm_syms, 2)/fft_length;
n_antennas = size(mod_ofdm_syms, 1);

resample_patt=[(fft_length/2)+1:fft_length 1:(fft_length/2)];
time_syms = zeros(n_antennas, num_symbols*fft_length);

% Convert each antenna's signal to time domain
for antenna = 1:n_antennas
   syms_into_ifft = zeros(fft_length, num_symbols);
   syms_into_ifft = reshape(mod_ofdm_syms(antenna,:), ...
      fft_length, num_symbols);
   syms_into_ifft(resample_patt,:) = syms_into_ifft;
   
   % Convert to time domain
   ifft_out = ifft(syms_into_ifft);
   time_syms(antenna,:) = ifft_out(:).';
end